/* Copyright - Apache License 2.0
 * 
 * The project "kyou" is
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *      http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.kyou.pack;

import java.io.ByteArrayInputStream;
import java.nio.charset.Charset;

import org.junit.Assert;
import org.junit.Test;

/**
 * 定义报文样式
 * 
 * @author NuclearG (<a href="mailto:nuclearg@163.com">nuclearg@163.com</a>)
 */
public class StyleSpecificationTest {
    @Test
    public void test() {
        String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><spec><config><encoding>utf-8</encoding></config></spec>";

        StyleSpecification spec = new StyleSpecification(new ByteArrayInputStream(xml.getBytes()));

        Assert.assertEquals(Charset.forName("utf-8"), spec.config.encoding);
        Assert.assertEquals(0, spec.styles.length);
        Assert.assertEquals(0, spec.scripts.length);
    }
}
